package week1;
import java.io.*;
public class _562_壁画_前缀和区间和 {
	// 解题思路：只需要将所有 (n+1)/2 的区间和计算，取最大值即可
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		int T = Integer.parseInt(br.readLine());
		
		for(int t = 1; t <= T; t++) {
			int n = Integer.parseInt(br.readLine());
			char c[] = br.readLine().toCharArray();
			int a[] = new int[n+1];
			for(int i = 1; i <= n; i++) {
				// 将字符转换成数组存储从1开始的a数组中
				a[i] = c[i-1] - '0';
				// 计算a数组前缀和
				a[i] += a[i-1];
			}
			int res = 0;
			// +1是因为题目是先画画，再销毁，所以当n是奇数，m = n/2+1 当n是偶数 m = n/2
			int m = (n+1)/2;
			// 从m开始，算出所有m区间的和 的最大值
			for(int i = m; i < a.length; i++) {
				res = Math.max(res, a[i] - a[i-m]);
			}
			bw.write("Case #" + t + ": " + res + "\n");
		}
		bw.flush();
		
	}
}
